package com.sands.base;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.google.gson.Gson;
import com.sands.network.util.ACache;
import com.sands.utils.ActivityCollector;

import butterknife.ButterKnife;


/**
 * Created by Administrator on 2016/12/29.
 */
public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {


    //缓存对象
    public static ACache baseACache;
    public static Gson mgson;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        ButterKnife.bind(this);
        //关闭所有activity
        ActivityCollector.addActivity(this);
        baseACache = ACache.get(this);
        mgson = new Gson();
        _onCreate(savedInstanceState);

    }

    protected abstract void _onCreate(Bundle savedInstanceState);


    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityCollector.finishActivity(this);

    }


    public abstract int getLayoutId() ;
}
